package com.szpx.service.impl;

import com.szpx.entity.Vip;
import com.szpx.mapper.VipManageMapper;
import com.szpx.service.VipManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Service
@Transactional //事务处理策略
public class VipManageServiceImpl implements VipManageService {

    @Autowired
    private VipManageMapper vipManageMapper;
    //根据id查询影片的信息
    @Override
    public Vip selectVipById(Integer id) {
        return vipManageMapper.selectByPrimaryKey(id);
    }

    //查询所有影片的信息
    @Override
    public List<Vip> selectAllVip() {
        return vipManageMapper.selectAll();
    }

    //添加影片信息
    @Override
    public int addVip(Vip vip) {
        return vipManageMapper.insertSelective(vip);
    }

    //删除影片信息
    @Override
    public int deleVip(Integer id) {
        return vipManageMapper.deleteByPrimaryKey(id);
    }

    //修改用户的信息
    @Override
    public int updateVip(Vip vip) {
        return vipManageMapper.updateByPrimaryKeySelective(vip);
    }

    //多条件分页模糊查询
    @Override
    public List<Vip> getListByInfo(Vip vip) {
        return vipManageMapper.getListByInfo(vip);
    }
}
